<script setup lang='ts'>
import { useUserStore } from '@/stores/user';
import { computed } from 'vue';

const props = defineProps({
	btnPerm: {
		type: String,
		default: ''
	}
});

// 超级管理员
const adminPerm = '*:*:*'

const isShow = computed(() => {

	const store = useUserStore()
	const perm = store.profile.permissions

	if (props.btnPerm === adminPerm) {
		return true
	}

	return perm.includes(props.btnPerm)
});
</script>

<template>
	<slot v-if="isShow"></slot>
</template>
